$(function () {
    $("#jqGrid").jqGrid({
        url: 'eform/eformdata/list',
        datatype: "json",
        colModel: [
            { label: '数据主键', name: 'dataId', hidden: true, key: true },
            { label: '关联模板主键', name: 'templateId', width: 60 },
			{ label: '关联表名', name: 'dataLinkTable', width: 70 },
			{ label: '关联表主键', name: 'dataLinkTableId', width: 100 },
			{ label: '数据文本', name: 'dataJson', width: 100 },
            { label: '状态', name: 'status', width: 60 },
			{ label: '创建时间', name: 'createTime', width: 100 }
        ],
		viewrecords: true,
        height: 450,
        rowNum: 10,
		rowList : [10,15,30,50,100,200],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
});

var vm = new Vue({
	el:'#efromdatasapp',
	data:{
		q:{
            keywords: null
		}
	},
	methods: {
		query: function () {
            console.log('query');
			$("#jqGrid").jqGrid('setGridParam',{ 
                postData:{'keywords': vm.q.keywords},
                page:1 
            }).trigger("reloadGrid");
		},
        preedit: function() {
            let dataId = getSelectedRow();
            if (dataId == null) {
                return;
            }
            window.open('template_preedit.html?dataId=' + dataId, "_blank");
        }
	}
});

